Imports MIMS.WRS.Business
Imports MIMS.WRS.Entities
Imports System.Data
Imports System.Data.Common

Public Class DataMissingReport
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents rptList As System.Web.UI.WebControls.Repeater

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Security.DenyIDSUser()

        Me.rptList.DataSource = ShippingStatusReportService.GetMissingDataReport(RequestContext.CurrentUser.ActiveOfficeID, RequestContext.ReportType)
        Me.rptList.DataBind()
    End Sub

    Protected Function GetBulkText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToString(data).Length = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Utilities.GetBulkMeaning(Convert.ToString(data))
        End If
    End Function

    Protected Function GetBulkOrderNoText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToInt32(data) = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Convert.ToInt32(data).ToString().PadLeft(6, "0"c)
        End If
    End Function

    'Protected Function GetSizeText(ByVal data As Object) As String
    '    If data Is DBNull.Value OrElse Convert.ToString(data).Length = 0 Then
    '        Return "<span class=""highlight"">N/A</span>"
    '    Else
    '        Return Convert.ToString(data)
    '    End If
    'End Function

    Protected Function GetPackText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToString(data).Length = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Utilities.GetPackMeaning(Convert.ToString(data))
        End If
    End Function

    Protected Function GetTypeText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToString(data).Length = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Utilities.GetTypeMeaning(Convert.ToString(data))
        End If
    End Function

    Protected Function GetPrimaryText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToString(data).Trim().Length = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Utilities.GetPrimaryMeaning(Convert.ToString(data))
        End If
    End Function

    Protected Function GetConText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToInt32(data) = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Convert.ToInt32(data).ToString()
        End If
    End Function

    Protected Function GetNullText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToString(data).Length = 0 Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Convert.ToString(data)
        End If
    End Function

    Protected Function GetOrderDateText(ByVal data As Object) As String
        If data Is DBNull.Value OrElse Convert.ToDateTime(data).Equals(Nulls.NullDate) Then
            Return "<span class=""highlight"">N/A</span>"
        Else
            Return Convert.ToDateTime(data).ToShortDateString()
        End If
    End Function


End Class
